<?php 
if(!$_SESSION['loginid'] || !$index)
{
    include('404.php');
}
else
{
?>
<center>
    <h2>Mijn Account</h2>
    <?php
        $ps = new PreparedStatement("SELECT *, COUNT(leiding.leidingid) AS leiding FROM accounts LEFT JOIN leiding ON accounts.accountid = leiding.accountid WHERE accounts.accountid = ? GROUP BY leiding.leidingid;");
        $ps->setInt($_SESSION['loginid']);
        $q = $ps->execute();
        $row = mysql_fetch_array($q);
        $ouder = 'no';
        $leiding = 'no';
        $admin = 'no';
        $beheerder = 'no';
        if($row['inschrijvingid'])
            $ouder = 'yes';
        if($row['leiding'])
            $leiding = 'yes';
        if($row['admin'])
            $admin = 'yes';
        if($row['beheerder'])
            $beheerder = 'yes';
        echo "<table>";
        echo "<tr><td width='140'>Gebruikersnaam:</td><td>{$row['username']}</td></tr>";
        echo "<tr><td>Ouder:</td><td><img src='images/icons/$ouder.gif' /></td></tr>";
        echo "<tr><td>Leiding:</td><td><img src='images/icons/$leiding.gif' /></td></tr>";
        echo "<tr><td>Admin:</td><td><img src='images/icons/$admin.gif' /></td></tr>";
        echo "<tr><td>Beheerder:</td><td><img src='images/icons/$beheerder.gif' /></td></tr>";
        echo "</table>";
    ?>
</center>
<?php } ?>
